﻿@using DTcms.Common;
@using DTcms.Model;
@{
   Layout = "~/Areas/admin/Views/Shared/_LayoutList.cshtml";
    ViewBag.Title = "url_rewrite_list";
    List<SelectListItem> channelList = ViewData["channelList"] as List<SelectListItem>;
    List<SelectListItem> typeList = ViewData["typeList"] as List<SelectListItem>;
    List<DTcms.Model.url_rewrite> list = ViewData["list"] as List<DTcms.Model.url_rewrite>;
}
@section HeaderContent{
   <script>
      //查询数据
      function search() {
         var channel = $("#ddlChannel").val();
         var type = $("#ddlPageType").val();
         document.location = "index?channel=" + channel + "&type=" + type;
      }

      //删除数据
      function __doPostBack() {
         var $row = $("#ltable tr:gt(0)");
         var json = { list: [] };
         $($row).each(function (i, item) {
            if ($(item).find("input:checkbox").prop("checked")) {
               var name = $(item).find("td:eq(0)").find("label:eq(0)").text();
               var obj = { name: name };
               json.list.push(obj);
            }
         });
         $.ajax({
            url: "SubmitDelete",
            type: "POST",
            dataType: "html",
            data: "json=" + JSON.stringify(json),
            success: function (data) {
               eval(data);
            },
            error: function () {
               alert("error");
            }
         });
      }
   </script>
}
<form id="form1"  method="post" action="#">
<!--导航栏-->
<div class="location">
  <a href="javascript:history.back(-1);" class="back"><i class="iconfont icon-up"></i><span>返回上一页</span></a>
  <a href="../../center/index"><i class="iconfont icon-home"></i><span>首页</span></a>
  <i class="arrow iconfont icon-arrow-right"></i>
  <span>系统管理</span>
  <i class="arrow iconfont icon-arrow-right"></i>
  <span>URL配置</span>
</div>
<!--/导航栏-->

<!--工具栏-->
<div id="floatHead" class="toolbar-wrap">
  <div class="toolbar">
    <div class="box-wrap">
      <a class="menu-btn"><i class="iconfont icon-more"></i></a><a class="menu-btn"><i class="iconfont icon-more"></i></a>
      <div class="l-list">
        <ul class="icon-list">
          <li><a href="../url_rewrite_edit/index?action=@DTEnums.ActionEnum.Add"><i class="iconfont icon-close"></i><span>新增</span></a></li>
          <li><a href="javascript:;" onclick="checkAll(this);"><i class="iconfont icon-check"></i><span>全选</span></a></li>
          <li><a href="javascript:;" id="btnDelete" onclick="ExePostBack('btnDelete','本操作会导致网站前台无法运作，是否继续？');"><i class="iconfont icon-delete"></i><span>删除</span></a></li>
        </ul>
        <div class="menu-list">
          <div class="rule-single-select">
            @Html.DropDownList("ddlChannel", new SelectList(channelList, "Value", "Text", ViewBag.Channel as string), new { onchange = "search();" })
          </div>
          <div class="rule-single-select">
            @Html.DropDownList("ddlPageType", new SelectList(typeList, "Value", "Text", ViewBag.Type), new { onchange="search();"})
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<!--/工具栏-->

<!--列表-->
<div class="table-container">
  <table width="100%" border="0" cellspacing="0" cellpadding="0" class="ltable" id="ltable">
    <tr>
      <th width="8%" style="white-space:nowrap;word-break:break-all;">选择</th>
      <th align="left">调用名称</th>
      <th width="20%" align="left">源页面名称</th>
      <th width="18%" align="left">继承类名</th>
      <th width="15%" align="left">模板名称</th>
      <th width="10%" align="left" style="white-space:nowrap;word-break:break-all;">归属频道</th>
      <th width="8%" align="left" style="white-space:nowrap;word-break:break-all;">分页数量</th>
      <th width="8%" style="white-space:nowrap;word-break:break-all;">操作</th>
    </tr>
@foreach(DTcms.Model.url_rewrite m in list){
    <tr>
      <td align="center">
        <span class="checkall" style="vertical-align:middle">
            <input type="checkbox" />
        </span>
        <label style="display:none">@m.name</label>
      </td>
      <td>@m.name</td>
      <td>@m.page</td>
      <td>@m.inherit</td>
      <td>@m.templet</td>
      <td>@(m.channel.ToString() == "" ? "-" : m.channel)</td>
      <td>@(m.pagesize.ToString() == "" ? "-" : m.pagesize)</td>
      <td align="center"><a href="../url_rewrite_edit/index?action=@DTEnums.ActionEnum.Edit&name=@m.name">修改</a></td>
    </tr>
}
@if (list.Count == 0) {
   <tr><td align="center" colspan="8">暂无记录</td></tr>
}
  </table>
</div>
<!--/列表-->

</form>
